package edu.gatech.cc.liam.core;

public class Tuple {
	
	public Object[] objs;

	public Tuple(Object ... objs) {
		super();
		this.objs = objs;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		for(int i=0; i<objs.length; i++) {
			result = prime * result + ((objs[i] == null) ? 0 : objs[i].hashCode());
		}
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Tuple other = (Tuple) obj;
		for(int i=0; i<objs.length; i++) {
			if (objs[i] == null) {
				if (other.objs[i] != null)
					return false;
			} else if (!objs[i].equals(other.objs[i]))
				return false;
		}
		return true;
	}
	@Override
	public String toString() {
		String rStr = "(";
		if(objs.length > 0)
			rStr += objs[0];
		for(int i=1; i<objs.length; i++)
			rStr += ", " + objs[i];
		rStr += ")";
		return rStr;
	}
}
